import type { PageLoad } from './$types'; export const load: PageLoad = async ({ params, fetch }) => { const id = params.id; const [servicesRes, historyRes, statsRes] = await Promise.all([ fetch(`http://localhost:8080/api/services`).catch(() => null), fetch(`http://localhost:8080/api/services/${id}/history`).catch(() => null), fetch(`http://localhost:8080/api/services/${id}/stats`).catch(() => null) ]); const services = servicesRes?.ok ? await servicesRes.json() : []; const svc = services.find((s: any) => s.id === Number(id)); const history = historyRes?.ok ? await historyRes.json() : []; const stats = statsRes?.ok ? await statsRes.json() : null; return { service: svc ?? null, history, stats }; };